<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="/WEB-INF/public/head.jsp" %>
<title>添加资料</title>

<script type="text/javascript" charset="utf-8" src="${system}/utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${system}/utf8-jsp/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${system}/utf8-jsp/lang/zh-cn/zh-cn.js"></script>

</head>
<script type="text/javascript">


    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');

    //获取编辑器中的值
    function getContent() {
        var content = UE.getEditor('editor').getContent();
        $("#context").val(content);
    }

    function save() {
        var file = $("#myfile");
        if ($.trim(file.val()) == '') {
            file.attr("name", "");
        }

        getContent();
        parent.initialize();//添加遮罩
        jquerySubByFId('resourcesaveform', save_callback, null, "json");

    }

    //ajax调用的回调函数，ajax请求完成调用此函数，传入的参数是action返回的结果
    function save_callback(data) {
        parent.subSomething();//解除遮罩
        window.location.href = "${system}/psr/toaddresource";


    }
</script>
</head>
<body>


<form id="resourcesaveform" action="${system}/psr/addresourcesubmit"
      method="post" enctype="multipart/form-data">
    <input type="hidden" name="context" value="" id="context"/>
    <input type="hidden" name="resourceurl" value="" id="resourceurl"/>
    <table border=0 cellSpacing=0 cellPadding=0 width="100%"
           bgColor=#c4d8ed>
        <tbody>
        <tr>
            <td background=${system}/images/r_0.gif width="100%">
                <table cellSpacing=0 cellPadding=0 width="100%">
                    <tbody>
                    <tr>
                        <td>&nbsp;添加资料</td>
                        <td align=right>&nbsp;</td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <TABLE class="toptable grid" border=1 cellSpacing=1 cellPadding=4
                       align=center>
                    <tbody>

                    <tr>
                        <td height=30 width="5%" align=right>标题：</td>
                        <td class=category width="15%">
                            <div>
                                <input type="text" id="title" name="title" style="width: 320px;"/>
                            </div>
                        <td height=30 width="5%" align=right>简介：</td>
                        <td class=category width="55%">
                            <div>
                                <input type="text" id="introduction" name="introduction" style="width: 750px;"/>
                            </div>
                    </tr>

                    <tr>
                        <td height=30 width="5%" align=right>类型：</td>
                        <td class=category width="15%">
                            <div>
                                <select name="typeid">
                                    <c:forEach items="${typelist}" var="t">
                                        <option value="${t.id}">${t.name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        <td height=30 width="5%" align=right>显示图片：</td>
                        <td class=category width="15%">
                            <div>
                                <input type="checkbox" value="3"/>显示
                            </div>
                    </tr>
                    <tr>
                        <td height=30 width="5%" align=right>图片：</td>
                        <td class=category width="15%">
                            <div>
                                <input type="file" name="myfile" id="myfile"/>
                            </div>
                    </tr>
                    </tbody>
                </TABLE>
            </td>
        </tr>
        </tbody>
    </table>
    <div>
        <script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
        </div>
        <a id="submitbtn" class="easyui-linkbutton" iconCls="icon-ok" href ="#" onclick="save()">

            提交 </a>
            </form>
            </body>
            </html>